package cn.wps.sdk.demo;

import android.app.Application;
import android.widget.Toast;
import cn.wps.moffice.sdk.WpsSdk;
import cn.wps.moffice.sdk.api.bean.Result;
import cn.wps.moffice.sdk.api.callback.ResultCallback;
import cn.wps.moffice.sdk.bean.SdkConfig;
import cn.wps.moffice.service.base.BuildConfig;

public class MyApplication extends Application {
    private static final String app_key = "f8Ea5BN73+Y6Wr/LiU75gOP4MZpZwCxws9bpVJHI38tiRgyDn3KMXiSaEY/CM/4unbBcCNQz40OptdWizgMOVQ==";
    private static final String app_secret = "S079U17QVO0iFd/HDkq1EGYwpIHMRoHPgE7MQwSoGGD/+EUGmj97CkKnePlT0kVnO9VpDjdLq2YXQhPjyBM3o1xXMikLNGkMwJO5iuk462KrGMjC32er2G0CKjy7DSRhClj11uCs/yIyVmI0x2lSWlg9kxW/A+N6XDyvzL8hv6JZQVndzXSJMh1buCYqKlPOXsTkRdrX4yUVz/+U8GkbLw6zqB/ihn+SaJ4/EMSoxv0tQd3PrAojubXpBSs3b3KF";

    @Override
    public void onCreate() {
        super.onCreate();
        //添加全局配置
        SdkConfig config = new SdkConfig.Builder()
                .setEnableDebug(BuildConfig.DEBUG)
//                    .setDisableShowInstallWpsDialog(true)//是否禁止弹出安装更新提示框
//                    .setWpsPackageName("自定义包名")
                .build();
        //初始化
        WpsSdk.getInstance().init(this, app_key, app_secret, config, new ResultCallback() {
            @Override
            public void onCallback(Result result) {
                if (result.code == 0){
                    Toast.makeText(MyApplication.this, "WPS SDK初始成功", Toast.LENGTH_SHORT).show();
                }else {
                    Toast.makeText(MyApplication.this, "初始化失败："+result, Toast.LENGTH_SHORT).show();
                }
            }
        });
    }
}
